<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>5.4 RegExp 类型</title>
    <script>
        let pattern = /[bc]at/i;
        let bat = pattern.test('bat');
        let cat = pattern.test('cat');
        let dat = pattern.test('dat');
        console.log(bat);
        console.log(cat);
        console.log(dat);

        let pattern1 = /[^www]\.[a-z]+\.[a-z]{2,3}$/;
        console.log(pattern1.test('www.xxmi.cn'));

        console.log('---------------');

        let str = 'cat, bat, sat, fat';
        let strReplace = str.replace('at', '#');
        console.log(strReplace);
        let pattern2 = /at/g;
        let strReplace2 = str.replace(pattern2, '#');
        console.log(strReplace2);
    </script>
</head>
<body>

</body>
</html>